﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class ViewEcard : System.Web.UI.Page
{
    private bussiness bus;
    string id;
    protected void Page_Load(object sender, EventArgs e)
    {
        bus = new bussiness();
        id = Request.QueryString["id"];
        List<Ecard> lstEcard = bus.getAllEcard();
        List<Ecard> lstEcard_display = new List<Ecard>();
        List<Ecard> lstEcard_cungtheloai = new List<Ecard>();
        foreach (Ecard ecard in lstEcard)
        {
            if (ecard.EcardId == Convert.ToInt32(id))
            {
                lstEcard_display.Add(ecard);
                Repeater1.DataSource = lstEcard_display;
                Repeater1.DataBind();
                Repeater2.DataSource = bus.getEcardByTypeId(ecard.TypeId);
                Repeater2.DataBind();
                break;
            }
        }

    }
    protected void btnSent_Click(object sender, EventArgs e)
    {
        if (Session["customer"] != null)
        {
            string url = "sentEcard.aspx?id=" + id;
            Response.Redirect(url);
        }
        else
        {
            Response.Redirect("Login.aspx");
        }

    }
}